namespace Melody_Glider.MelodyContent
{
    public class Note
    {
        private Pitch _pitch;
        private double _duration;
        private readonly bool _ligature;
        private readonly bool _dotted;
        private readonly bool _staccato;

        public Note(Pitch pitch, double duration, bool ligature, bool dotted, bool staccato)
        {
            _pitch = pitch;
            _duration = duration;
            _ligature = ligature;
            _dotted = dotted;
            _staccato = staccato;
        }

        public Note(Note note)
        {
            _pitch = note.GetPitch();
            _duration = note.GetDuration();
            _ligature = note.IsLigature();
            _dotted = note.IsDotted();
            _staccato = note.IsStaccato(); //why can I access note._staccato here?
        }

        public Pitch GetPitch()
        {
            return _pitch;
        }

        public void SetPitch(Pitch pitch)
        {
            _pitch = pitch;
        }

        public double GetDuration()
        {
            return _duration;
        }

        public void SetDuration(double duration)
        {
            _duration = duration;
        }

        public bool IsSharp()
        {
            return _pitch.Symbol == Pitch.Cs || _pitch.Symbol == Pitch.Fs || _pitch.Symbol == Pitch.Gs;
        }

        public bool IsFlat()
        {
            return _pitch.Symbol == Pitch.Eb || _pitch.Symbol == Pitch.Bb;
        }
        
        public bool IsRest()
        {
            return _pitch.Symbol == Pitch.R;
        }

        public bool IsLigature()
        {
            return _ligature;
        }

        public bool IsDotted()
        {
            return _dotted;
        }

        public bool IsStaccato()
        {
            return _staccato;
        }
    }
}